using System;
using System.Collections.Generic;
using System.Reflection;
using System.Runtime.InteropServices;

using ILRuntime.CLR.TypeSystem;
using ILRuntime.CLR.Method;
using ILRuntime.Runtime.Enviorment;
using ILRuntime.Runtime.Intepreter;
using ILRuntime.Runtime.Stack;
using ILRuntime.Reflection;
using ILRuntime.CLR.Utils;
using System.Linq;

namespace ILRuntime.Runtime.Generated
{
    unsafe class huqiang_Communication_NetworkLink_Binding
    {
        public static void Register(ILRuntime.Runtime.Enviorment.AppDomain app)
        {
            BindingFlags flag = BindingFlags.Public | BindingFlags.Instance | BindingFlags.Static | BindingFlags.DeclaredOnly;
            MethodBase method;
            FieldInfo field;
            Type[] args;
            Type type = typeof(huqiang.Communication.NetworkLink);
            args = new Type[]{};
            method = type.GetMethod("get_Connected", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, get_Connected_0);
            args = new Type[]{};
            method = type.GetMethod("Dispose", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Dispose_1);
            args = new Type[]{typeof(System.Byte[]), typeof(System.Int32)};
            method = type.GetMethod("Post", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Post_2);
            args = new Type[]{typeof(System.Int32), typeof(System.Byte[]), typeof(System.Int32)};
            method = type.GetMethod("FrocePost", flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, FrocePost_3);

            field = type.GetField("ip", flag);
            app.RegisterCLRFieldGetter(field, get_ip_0);
            app.RegisterCLRFieldSetter(field, set_ip_0);
            app.RegisterCLRFieldBinding(field, CopyToStack_ip_0, AssignFromStack_ip_0);
            field = type.GetField("port", flag);
            app.RegisterCLRFieldGetter(field, get_port_1);
            app.RegisterCLRFieldSetter(field, set_port_1);
            app.RegisterCLRFieldBinding(field, CopyToStack_port_1, AssignFromStack_port_1);
            field = type.GetField("buffIndex", flag);
            app.RegisterCLRFieldGetter(field, get_buffIndex_2);
            app.RegisterCLRFieldSetter(field, set_buffIndex_2);
            app.RegisterCLRFieldBinding(field, CopyToStack_buffIndex_2, AssignFromStack_buffIndex_2);
            field = type.GetField("id", flag);
            app.RegisterCLRFieldGetter(field, get_id_3);
            app.RegisterCLRFieldSetter(field, set_id_3);
            app.RegisterCLRFieldBinding(field, CopyToStack_id_3, AssignFromStack_id_3);
            field = type.GetField("endPoint", flag);
            app.RegisterCLRFieldGetter(field, get_endPoint_4);
            app.RegisterCLRFieldSetter(field, set_endPoint_4);
            app.RegisterCLRFieldBinding(field, CopyToStack_endPoint_4, AssignFromStack_endPoint_4);
            field = type.GetField("RecyclingTime", flag);
            app.RegisterCLRFieldGetter(field, get_RecyclingTime_5);
            app.RegisterCLRFieldSetter(field, set_RecyclingTime_5);
            app.RegisterCLRFieldBinding(field, CopyToStack_RecyclingTime_5, AssignFromStack_RecyclingTime_5);


            app.RegisterCLRCreateDefaultInstance(type, () => new huqiang.Communication.NetworkLink());
            app.RegisterCLRCreateArrayInstance(type, s => new huqiang.Communication.NetworkLink[s]);

            args = new Type[]{};
            method = type.GetConstructor(flag, null, args, null);
            app.RegisterCLRMethodRedirection(method, Ctor_0);

        }


        static StackObject* get_Connected_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.NetworkLink instance_of_this_method = (huqiang.Communication.NetworkLink)typeof(huqiang.Communication.NetworkLink).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Connected;

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* Dispose_1(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 1);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            huqiang.Communication.NetworkLink instance_of_this_method = (huqiang.Communication.NetworkLink)typeof(huqiang.Communication.NetworkLink).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.Dispose();

            return __ret;
        }

        static StackObject* Post_2(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 3);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @bid = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Byte[] @dat = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            huqiang.Communication.NetworkLink instance_of_this_method = (huqiang.Communication.NetworkLink)typeof(huqiang.Communication.NetworkLink).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            var result_of_this_method = instance_of_this_method.Post(@dat, @bid);

            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method ? 1 : 0;
            return __ret + 1;
        }

        static StackObject* FrocePost_3(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* ptr_of_this_method;
            StackObject* __ret = ILIntepreter.Minus(__esp, 4);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 1);
            System.Int32 @msgID = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 2);
            System.Byte[] @dat = (System.Byte[])typeof(System.Byte[]).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            ptr_of_this_method = ILIntepreter.Minus(__esp, 3);
            System.Int32 @id = ptr_of_this_method->Value;

            ptr_of_this_method = ILIntepreter.Minus(__esp, 4);
            huqiang.Communication.NetworkLink instance_of_this_method = (huqiang.Communication.NetworkLink)typeof(huqiang.Communication.NetworkLink).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            __intp.Free(ptr_of_this_method);

            instance_of_this_method.FrocePost(@id, @dat, @msgID);

            return __ret;
        }


        static object get_ip_0(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).ip;
        }

        static StackObject* CopyToStack_ip_0(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).ip;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_ip_0(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).ip = (System.Int32)v;
        }

        static StackObject* AssignFromStack_ip_0(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @ip = ptr_of_this_method->Value;
            ((huqiang.Communication.NetworkLink)o).ip = @ip;
            return ptr_of_this_method;
        }

        static object get_port_1(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).port;
        }

        static StackObject* CopyToStack_port_1(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).port;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_port_1(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).port = (System.Int32)v;
        }

        static StackObject* AssignFromStack_port_1(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @port = ptr_of_this_method->Value;
            ((huqiang.Communication.NetworkLink)o).port = @port;
            return ptr_of_this_method;
        }

        static object get_buffIndex_2(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).buffIndex;
        }

        static StackObject* CopyToStack_buffIndex_2(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).buffIndex;
            __ret->ObjectType = ObjectTypes.Integer;
            __ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_buffIndex_2(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).buffIndex = (System.Int32)v;
        }

        static StackObject* AssignFromStack_buffIndex_2(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int32 @buffIndex = ptr_of_this_method->Value;
            ((huqiang.Communication.NetworkLink)o).buffIndex = @buffIndex;
            return ptr_of_this_method;
        }

        static object get_id_3(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).id;
        }

        static StackObject* CopyToStack_id_3(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).id;
            __ret->ObjectType = ObjectTypes.Long;
            *(long*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_id_3(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).id = (System.Int64)v;
        }

        static StackObject* AssignFromStack_id_3(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int64 @id = *(long*)&ptr_of_this_method->Value;
            ((huqiang.Communication.NetworkLink)o).id = @id;
            return ptr_of_this_method;
        }

        static object get_endPoint_4(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).endPoint;
        }

        static StackObject* CopyToStack_endPoint_4(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).endPoint;
            object obj_result_of_this_method = result_of_this_method;
            if(obj_result_of_this_method is CrossBindingAdaptorType)
            {    
                return ILIntepreter.PushObject(__ret, __mStack, ((CrossBindingAdaptorType)obj_result_of_this_method).ILInstance);
            }
            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }

        static void set_endPoint_4(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).endPoint = (System.Net.IPEndPoint)v;
        }

        static StackObject* AssignFromStack_endPoint_4(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Net.IPEndPoint @endPoint = (System.Net.IPEndPoint)typeof(System.Net.IPEndPoint).CheckCLRTypes(StackObject.ToObject(ptr_of_this_method, __domain, __mStack), (CLR.Utils.Extensions.TypeFlags)0);
            ((huqiang.Communication.NetworkLink)o).endPoint = @endPoint;
            return ptr_of_this_method;
        }

        static object get_RecyclingTime_5(ref object o)
        {
            return ((huqiang.Communication.NetworkLink)o).RecyclingTime;
        }

        static StackObject* CopyToStack_RecyclingTime_5(ref object o, ILIntepreter __intp, StackObject* __ret, IList<object> __mStack)
        {
            var result_of_this_method = ((huqiang.Communication.NetworkLink)o).RecyclingTime;
            __ret->ObjectType = ObjectTypes.Long;
            *(long*)&__ret->Value = result_of_this_method;
            return __ret + 1;
        }

        static void set_RecyclingTime_5(ref object o, object v)
        {
            ((huqiang.Communication.NetworkLink)o).RecyclingTime = (System.Int64)v;
        }

        static StackObject* AssignFromStack_RecyclingTime_5(ref object o, ILIntepreter __intp, StackObject* ptr_of_this_method, IList<object> __mStack)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            System.Int64 @RecyclingTime = *(long*)&ptr_of_this_method->Value;
            ((huqiang.Communication.NetworkLink)o).RecyclingTime = @RecyclingTime;
            return ptr_of_this_method;
        }



        static StackObject* Ctor_0(ILIntepreter __intp, StackObject* __esp, IList<object> __mStack, CLRMethod __method, bool isNewObj)
        {
            ILRuntime.Runtime.Enviorment.AppDomain __domain = __intp.AppDomain;
            StackObject* __ret = ILIntepreter.Minus(__esp, 0);

            var result_of_this_method = new huqiang.Communication.NetworkLink();

            return ILIntepreter.PushObject(__ret, __mStack, result_of_this_method);
        }


    }
}
